package com.zzyl.mapper;

import com.aliyun.iot20180120.models.DeleteDeviceRequest;
import com.github.pagehelper.Page;
import com.zzyl.dto.DevicePageQueryDto;
import com.zzyl.entity.Device;
import com.zzyl.vo.DeviceVo;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface DeviceMapper {
    int deleteByPrimaryKey(Long id);

    int insert(Device record);

    int insertSelective(Device record);

    Device selectByPrimaryKey(Long id);

    int updateByPrimaryKeySelective(Device record);

    int updateByPrimaryKey(Device record);

    /**
     * 这是Mybatis Generator拓展插件生成的方法(请勿删除).
     * This method corresponds to the database table device
     *
     * @mbg.generated
     * @author hewei
     */
    int batchInsert(@Param("list") List<Device> list);

    @Select("select count(1) from device where device_name = #{deviceName}")
    Long countByDeviceName(String deviceName);

    // 分页查询设备列表
    Page<DeviceVo> selectByPage(DevicePageQueryDto devicePageQueryDto);

    //查询设备详细数据
    DeviceVo selectByIotId(String iotId);

    //删除设备中信息
    void deleteByIotId(String iotId);

    // 通过iotId查询对应的护理员
    List<Long> selectNursingIdsByIotIdWithElder(String iotId);

    List<Long> selectNursingIdsByIotIdWithBed(String iotId);
}